package com.example.design.mediator;

/**
 * 咖啡机，具体同事类
 * @author hej
 * @date 2022/11/4 17:32
 */
public class CoffeeMachine extends Colleague {
    public CoffeeMachine(Mediator mediator, String name) {
        super(mediator, name);
        mediator.register(name,this);
    }

    @Override
    void sendMessage(int stateChange) {
        this.getMediator().getMessage(stateChange,this.getName());
    }

    public void startCoffee(){
        System.out.println("咖啡机启动。。。。");
    }

    public void stopCoffee(){
        System.out.println("咖啡机关闭。。。。");
        sendMessage(0);
    }
}
